<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<style>
    /* CSS resize 方案 */
    
    .image-slider {
        position: relative;
        display: inline-block;
        user-select: none
    }
    
    .image-slider>div {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 50%;
        /* 初始宽度 */
        overflow: hidden;
        resize: horizontal;
        max-width: 100%;
    }
    
    .image-slider>div::before {
        content: '';
        position: absolute;
        bottom: 0;
        right: 0;
        width: 12px;
        height: 12px;
        background: white;
        cursor: ew-resize;
        padding: 5px;
        background: linear-gradient(-45deg, white 50%, transparent 0);
        background-clip: content-box;
    }
    
    .image-slider img {
        display: block;
        user-select: none;
    }
</style>

<body>
    <!-- 交互式的图片对比控件 -->
    <div class="image-slider">
        <div>
            <img src="adamcatlace-before.jpg" alt="Before" />
        </div>
        <img src="adamcatlace-after.jpg" alt="After" />
    </div>
</body>

</html>